#https://www.luogu.com.cn/problem/P1449

expr=readline
arr=expr.gsub(/[\+\-\*\/]/,'+'=>'+.','-'=>'-.','*'=>'*.','/'=>'/.').split('.')
stack=[]
def stack.pop_two()
	r=self.pop()
	l=self.pop()
	return l,r
end
End_of_string='@'
for i in arr
	if "0123456789".include?(i[0])
		stack.push(i.to_i)
	elsif '+-*/'.include?(i[0])
		l,r=stack.pop_two
		stack.push(l.send(i.to_sym,r))
	elsif i[0]=='@'
		break
	end
end

puts stack[-1] 

